package me.yricky.mayu.ui.tasks.taskui.orf

import androidx.compose.foundation.layout.*
import androidx.compose.material.*
import androidx.compose.material.icons.Icons
import androidx.compose.material.icons.rounded.Add
import androidx.compose.material.icons.rounded.FindInPage
import androidx.compose.runtime.*
import androidx.compose.ui.Modifier
import androidx.compose.ui.graphics.vector.rememberVectorPainter
import androidx.compose.ui.unit.dp
import androidx.compose.ui.window.Dialog
import me.yricky.mayu.ui.GridItemButton
import java.awt.Dimension

/**
 * @author Yricky
 * @date 2022/4/30
 */

@Composable
fun ORFFindTaskEntry(modifier: Modifier = Modifier.fillMaxWidth().height(160.dp)){
    var showDialog by remember { mutableStateOf(false) }
    GridItemButton({
        showDialog = true
    },modifier, Icons.Rounded.FindInPage){
        Text("ORF查找")
    }
    ORFFindTaskDialog(showDialog){ showDialog = false }
}

@Composable
fun ORFFindTaskDialog(showDialog:Boolean,onClose:()->Unit) = Dialog(onClose, visible = showDialog, title = "新建ORF查找任务", icon = rememberVectorPainter(
    Icons.Rounded.Add)
){
    LaunchedEffect(Unit){
        window.minimumSize = Dimension(800,600)
    }
}